<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: user_avatar.php
| Author: olelau
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."user_avatar.php";


if (!iMEMBER){ redirect("".INFUSIONS."restricted/restricted.php"); }



opentable($locale['ua100']);


$spalten=4;
$result = dbquery("SELECT user_id, user_name,user_location,user_lastvisit,user_birthdate, user_avatar FROM ".DB_USERS." WHERE user_avatar != '' order by user_name");
echo "<table width='90%' class='tbl-border' cellspacing='1' cellpadding='0' align='center'>\n";



echo " <tr>";

$l=1;
while ($data = dbarray($result)) {
$l++;



if ($data['user_birthdate'] != "0000-00-00")
{
$user_age = explode("-", $data['user_birthdate']);
$user_birthyear = $user_age[0];
$current_year = date("Y", time());
$user_age_years = $current_year - $user_birthyear;

if (mktime(0,0,0,$user_age[1], $user_age[2], $current_year) > time())
{
$user_age_years--;
}
$user_age_years = "".$user_age_years." ".$locale['ua102']."";

}
else
{
$user_age_years = "".$locale['ua101']."";
}

$img = "<img src='".BASEDIR."images/mail.gif' border='0' alt='' />";



echo "<td width='25%' valign='top' class='tbl1'><center><br>";



echo "<a href='".BASEDIR."profile.php?lookup=".$data['user_id']."' alt='".$data['user_name']."'>
";

if(dbrows($result)!=0){

echo "
<b>".$data['user_name']."</b><br><br>

<img src='".BASEDIR."images/avatars/".$data['user_avatar']."' alt='".$data['user_name']."' border='0' height='80'  width='80' /><br />
<a href='".BASEDIR."messages.php?msg_send=".$data['user_id']."' target='_parent'>".$img." ".$locale['ua103']."
 </a>
 <br />
".$locale['ua104']." ".$user_age_years." <br />
".$locale['ua105']." ".($data['user_location'] ? $data['user_location'] : $locale['ua101'])."
<br />
".$locale['ua106']." ".showdate("%d.%m.%y", $data['user_lastvisit'])."

</center>\n";
}
echo "</td>";


if (($l-1)%$spalten==0) echo "</tr>\n";

}
echo "</table>";



closetable();




require_once THEMES."templates/footer.php";
?>